/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * mainMenu.java
 *
 * Created on Sep 26, 2010, 3:06:43 PM
 */

package mpr;

import java.io.FileInputStream;
import javax.sound.midi.*;
import javax.swing.Icon;
import javax.swing.ImageIcon;
import javax.swing.JFileChooser;

/**
 *
 * @author Ephraim
 */
public class mainMenu extends javax.swing.JFrame {

   Sequencer sequencer;
    boolean minDummy = true;
    /** Creates new form mainMenu */
    public mainMenu() {
        try {
            javax.swing.UIManager.setLookAndFeel(javax.swing.UIManager.getSystemLookAndFeelClassName());
        }
        catch (Exception e) {
            System.out.println(e);
        }
        initComponents();
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        basePane = new javax.swing.JLayeredPane();
        phasePane = new javax.swing.JLayeredPane();
        minimizedScore = new javax.swing.JPanel();
        minimizedDummyImage = new javax.swing.JLabel();
        minimizedLabel = new javax.swing.JLabel();
        jSeparator2 = new javax.swing.JSeparator();
        mainRightPane = new javax.swing.JLayeredPane();
        windowSymbols = new javax.swing.JInternalFrame();
        symbolWN = new javax.swing.JToggleButton();
        symbolHN = new javax.swing.JToggleButton();
        symbolQN = new javax.swing.JToggleButton();
        symbolEN = new javax.swing.JToggleButton();
        symbolSN = new javax.swing.JToggleButton();
        symbolWR = new javax.swing.JToggleButton();
        symbolHR = new javax.swing.JToggleButton();
        symbolQR = new javax.swing.JToggleButton();
        symbolER = new javax.swing.JToggleButton();
        symbolSR = new javax.swing.JToggleButton();
        dummyNewPane = new javax.swing.JInternalFrame();
        mainPanel1 = new javax.swing.JPanel();
        jLabel3 = new javax.swing.JLabel();
        dummySamplePane = new javax.swing.JInternalFrame();
        dummyScrollPane = new javax.swing.JScrollPane();
        dummyImage = new javax.swing.JLabel();
        toggleImageStatus = new javax.swing.JLabel();
        shortcutScan = new javax.swing.JButton();
        shortcutOpen = new javax.swing.JButton();
        jSeparator1 = new javax.swing.JSeparator();
        playBackToolbar = new javax.swing.JToolBar();
        stopButton = new javax.swing.JButton();
        playButton = new javax.swing.JButton();
        paueButton = new javax.swing.JButton();
        background = new javax.swing.JLabel();
        mainBar = new javax.swing.JMenuBar();
        File = new javax.swing.JMenu();
        fileNew = new javax.swing.JMenu();
        newFile = new javax.swing.JMenuItem();
        newScan = new javax.swing.JMenuItem();
        fileSeperator1 = new javax.swing.JSeparator();
        fileOpen = new javax.swing.JMenuItem();
        fileClose = new javax.swing.JMenuItem();
        fileSeperator2 = new javax.swing.JSeparator();
        fileSave = new javax.swing.JMenuItem();
        fileSaveAs = new javax.swing.JMenuItem();
        fileSeperator3 = new javax.swing.JSeparator();
        filePrint = new javax.swing.JMenuItem();
        fileSeperator4 = new javax.swing.JSeparator();
        fileExit = new javax.swing.JMenuItem();
        Edit = new javax.swing.JMenu();
        editCut = new javax.swing.JMenuItem();
        editCopy = new javax.swing.JMenuItem();
        editPaste = new javax.swing.JMenuItem();
        Tools = new javax.swing.JMenu();
        toolsRun = new javax.swing.JMenuItem();
        Window = new javax.swing.JMenu();
        windowMusicalSymbols = new javax.swing.JCheckBoxMenuItem();
        Help = new javax.swing.JMenu();
        helpAbout = new javax.swing.JMenuItem();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setTitle("Piano Score Player");
        setResizable(false);

        minimizedScore.setBackground(new java.awt.Color(0, 0, 0));

        minimizedDummyImage.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Images/minSampleMusicSheet.png"))); // NOI18N
        minimizedDummyImage.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                minimizedSelected(evt);
            }
            public void mouseEntered(java.awt.event.MouseEvent evt) {
                minimizedEntered(evt);
            }
            public void mouseExited(java.awt.event.MouseEvent evt) {
                minimizedExited(evt);
            }
        });

        minimizedLabel.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
        minimizedLabel.setForeground(new java.awt.Color(255, 255, 255));
        minimizedLabel.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);

        javax.swing.GroupLayout minimizedScoreLayout = new javax.swing.GroupLayout(minimizedScore);
        minimizedScore.setLayout(minimizedScoreLayout);
        minimizedScoreLayout.setHorizontalGroup(
            minimizedScoreLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, minimizedScoreLayout.createSequentialGroup()
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addComponent(minimizedDummyImage)
                .addContainerGap())
            .addGroup(minimizedScoreLayout.createSequentialGroup()
                .addGap(30, 30, 30)
                .addComponent(minimizedLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 148, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(32, Short.MAX_VALUE))
        );
        minimizedScoreLayout.setVerticalGroup(
            minimizedScoreLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(minimizedScoreLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(minimizedDummyImage, javax.swing.GroupLayout.DEFAULT_SIZE, 228, Short.MAX_VALUE)
                .addGap(3, 3, 3)
                .addComponent(minimizedLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 18, javax.swing.GroupLayout.PREFERRED_SIZE))
        );

        minimizedScore.setBounds(10, 40, 210, 260);
        phasePane.add(minimizedScore, javax.swing.JLayeredPane.DEFAULT_LAYER);
        minimizedScore.setVisible(false);

        jSeparator2.setOrientation(javax.swing.SwingConstants.VERTICAL);
        jSeparator2.setBounds(230, 0, 10, 530);
        phasePane.add(jSeparator2, javax.swing.JLayeredPane.DEFAULT_LAYER);

        windowSymbols.setClosable(true);
        windowSymbols.setResizable(true);
        windowSymbols.setTitle("Symbols");

        symbolWN.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Images/wholenote.png"))); // NOI18N
        symbolWN.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                symbolWNActionPerformed(evt);
            }
        });

        symbolHN.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Images/halfnote.png"))); // NOI18N

        symbolQN.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Images/quarternote.png"))); // NOI18N

        symbolEN.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Images/eighthnote.png"))); // NOI18N

        symbolSN.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Images/sixteenthnote.png"))); // NOI18N

        symbolWR.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Images/wholerest.png"))); // NOI18N

        symbolHR.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Images/halfrest.png"))); // NOI18N

        symbolQR.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Images/quarterrest.png"))); // NOI18N

        symbolER.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Images/eighthrest.png"))); // NOI18N

        symbolSR.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Images/sixteenthrest.png"))); // NOI18N

        javax.swing.GroupLayout windowSymbolsLayout = new javax.swing.GroupLayout(windowSymbols.getContentPane());
        windowSymbols.getContentPane().setLayout(windowSymbolsLayout);
        windowSymbolsLayout.setHorizontalGroup(
            windowSymbolsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(windowSymbolsLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(windowSymbolsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(windowSymbolsLayout.createSequentialGroup()
                        .addComponent(symbolWN, javax.swing.GroupLayout.PREFERRED_SIZE, 35, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(symbolHN, javax.swing.GroupLayout.PREFERRED_SIZE, 35, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(windowSymbolsLayout.createSequentialGroup()
                        .addComponent(symbolQN, javax.swing.GroupLayout.PREFERRED_SIZE, 35, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(symbolEN, javax.swing.GroupLayout.PREFERRED_SIZE, 35, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(windowSymbolsLayout.createSequentialGroup()
                        .addComponent(symbolSN, javax.swing.GroupLayout.PREFERRED_SIZE, 35, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(symbolWR, javax.swing.GroupLayout.PREFERRED_SIZE, 35, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(windowSymbolsLayout.createSequentialGroup()
                        .addComponent(symbolHR, javax.swing.GroupLayout.PREFERRED_SIZE, 35, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(symbolQR, javax.swing.GroupLayout.PREFERRED_SIZE, 35, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(windowSymbolsLayout.createSequentialGroup()
                        .addComponent(symbolER, javax.swing.GroupLayout.PREFERRED_SIZE, 35, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(symbolSR, javax.swing.GroupLayout.PREFERRED_SIZE, 35, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        windowSymbolsLayout.setVerticalGroup(
            windowSymbolsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(windowSymbolsLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(windowSymbolsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(symbolWN, javax.swing.GroupLayout.PREFERRED_SIZE, 35, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(symbolHN, javax.swing.GroupLayout.PREFERRED_SIZE, 35, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(windowSymbolsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(symbolQN, javax.swing.GroupLayout.PREFERRED_SIZE, 35, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(symbolEN, javax.swing.GroupLayout.PREFERRED_SIZE, 35, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(windowSymbolsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(symbolWR, javax.swing.GroupLayout.PREFERRED_SIZE, 35, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(symbolSN, javax.swing.GroupLayout.PREFERRED_SIZE, 35, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(windowSymbolsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(symbolHR, javax.swing.GroupLayout.PREFERRED_SIZE, 35, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(symbolQR, javax.swing.GroupLayout.PREFERRED_SIZE, 35, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(windowSymbolsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(symbolER, javax.swing.GroupLayout.PREFERRED_SIZE, 35, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(symbolSR, javax.swing.GroupLayout.PREFERRED_SIZE, 35, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(46, 46, 46))
        );

        windowSymbols.setBounds(640, 60, 110, 250);
        mainRightPane.add(windowSymbols, javax.swing.JLayeredPane.DEFAULT_LAYER);

        dummyNewPane.setClosable(true);
        dummyNewPane.setTitle("Untitled");

        javax.swing.GroupLayout mainPanel1Layout = new javax.swing.GroupLayout(mainPanel1);
        mainPanel1.setLayout(mainPanel1Layout);
        mainPanel1Layout.setHorizontalGroup(
            mainPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 0, Short.MAX_VALUE)
        );
        mainPanel1Layout.setVerticalGroup(
            mainPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 371, Short.MAX_VALUE)
        );

        jLabel3.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Images/dummyNewSheet.png"))); // NOI18N

        javax.swing.GroupLayout dummyNewPaneLayout = new javax.swing.GroupLayout(dummyNewPane.getContentPane());
        dummyNewPane.getContentPane().setLayout(dummyNewPaneLayout);
        dummyNewPaneLayout.setHorizontalGroup(
            dummyNewPaneLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(dummyNewPaneLayout.createSequentialGroup()
                .addComponent(jLabel3)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(mainPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        dummyNewPaneLayout.setVerticalGroup(
            dummyNewPaneLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(dummyNewPaneLayout.createSequentialGroup()
                .addComponent(jLabel3)
                .addContainerGap())
            .addComponent(mainPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
        );

        dummyNewPane.setBounds(150, 60, 520, 390);
        mainRightPane.add(dummyNewPane, javax.swing.JLayeredPane.DEFAULT_LAYER);

        dummySamplePane.setClosable(true);
        dummySamplePane.setIconifiable(true);
        dummySamplePane.setMaximizable(true);
        dummySamplePane.setResizable(true);
        dummySamplePane.setTitle("Moonlight Sonata - Generated Score");
        dummySamplePane.setAutoscrolls(true);

        dummyImage.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        dummyImage.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Images/GeneratedMusicSheet.png"))); // NOI18N
        dummyScrollPane.setViewportView(dummyImage);
        dummyImage.setLocation(dummySamplePane.getX()/2, dummySamplePane.getY()/2);

        javax.swing.GroupLayout dummySamplePaneLayout = new javax.swing.GroupLayout(dummySamplePane.getContentPane());
        dummySamplePane.getContentPane().setLayout(dummySamplePaneLayout);
        dummySamplePaneLayout.setHorizontalGroup(
            dummySamplePaneLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(dummyScrollPane, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 614, Short.MAX_VALUE)
        );
        dummySamplePaneLayout.setVerticalGroup(
            dummySamplePaneLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(dummyScrollPane, javax.swing.GroupLayout.DEFAULT_SIZE, 401, Short.MAX_VALUE)
        );

        dummySamplePane.setBounds(60, 40, 630, 430);
        mainRightPane.add(dummySamplePane, javax.swing.JLayeredPane.DEFAULT_LAYER);

        mainRightPane.setBounds(230, 0, 790, 530);
        phasePane.add(mainRightPane, javax.swing.JLayeredPane.DEFAULT_LAYER);

        toggleImageStatus.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
        toggleImageStatus.setForeground(new java.awt.Color(255, 255, 255));
        toggleImageStatus.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        toggleImageStatus.setBounds(10, 10, 210, 20);
        phasePane.add(toggleImageStatus, javax.swing.JLayeredPane.DEFAULT_LAYER);

        phasePane.setBounds(0, 100, 1020, 530);
        basePane.add(phasePane, javax.swing.JLayeredPane.DEFAULT_LAYER);

        shortcutScan.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Images/newButton.png"))); // NOI18N
        shortcutScan.setRolloverIcon(new javax.swing.ImageIcon(getClass().getResource("/Images/newOverButton.png"))); // NOI18N
        shortcutScan.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                shortcutScanActionPerformed(evt);
            }
        });
        shortcutScan.setBounds(10, 50, 120, 40);
        basePane.add(shortcutScan, javax.swing.JLayeredPane.DEFAULT_LAYER);

        shortcutOpen.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Images/openButton.png"))); // NOI18N
        shortcutOpen.setRolloverIcon(new javax.swing.ImageIcon(getClass().getResource("/Images/openOverButton.png"))); // NOI18N
        shortcutOpen.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                shortcutOpenActionPerformed(evt);
            }
        });
        shortcutOpen.setBounds(140, 50, 120, 40);
        basePane.add(shortcutOpen, javax.swing.JLayeredPane.DEFAULT_LAYER);
        jSeparator1.setBounds(-20, 97, 1050, 10);
        basePane.add(jSeparator1, javax.swing.JLayeredPane.DEFAULT_LAYER);

        playBackToolbar.setBackground(new java.awt.Color(0, 0, 0));
        playBackToolbar.setFloatable(false);
        playBackToolbar.setRollover(true);

        stopButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Images/stopButton.png"))); // NOI18N
        stopButton.setFocusable(false);
        stopButton.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        stopButton.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        stopButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                stopButtonActionPerformed(evt);
            }
        });
        playBackToolbar.add(stopButton);

        playButton.setBackground(new java.awt.Color(0, 0, 0));
        playButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Images/playButton.png"))); // NOI18N
        playButton.setFocusable(false);
        playButton.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        playButton.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        playButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                playButtonActionPerformed(evt);
            }
        });
        playBackToolbar.add(playButton);

        paueButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Images/pauseButton.png"))); // NOI18N
        paueButton.setFocusable(false);
        paueButton.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        paueButton.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        paueButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                paueButtonActionPerformed(evt);
            }
        });
        playBackToolbar.add(paueButton);

        playBackToolbar.setBounds(270, 50, 120, 40);
        basePane.add(playBackToolbar, javax.swing.JLayeredPane.DEFAULT_LAYER);

        background.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Images/background.png"))); // NOI18N
        background.setBounds(0, 0, 1024, 630);
        basePane.add(background, javax.swing.JLayeredPane.DEFAULT_LAYER);

        File.setText("File");

        fileNew.setText("New");

        newFile.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_N, java.awt.event.InputEvent.CTRL_MASK));
        newFile.setText("Create New File");
        newFile.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                newFileActionPerformed(evt);
            }
        });
        fileNew.add(newFile);

        newScan.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_N, java.awt.event.InputEvent.ALT_MASK | java.awt.event.InputEvent.CTRL_MASK));
        newScan.setText("Import From Scanner");
        fileNew.add(newScan);

        File.add(fileNew);
        File.add(fileSeperator1);

        fileOpen.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_O, java.awt.event.InputEvent.CTRL_MASK));
        fileOpen.setText("Open");
        File.add(fileOpen);

        fileClose.setText("Close");
        File.add(fileClose);
        File.add(fileSeperator2);

        fileSave.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_S, java.awt.event.InputEvent.CTRL_MASK));
        fileSave.setText("Save");
        File.add(fileSave);

        fileSaveAs.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_S, java.awt.event.InputEvent.SHIFT_MASK | java.awt.event.InputEvent.CTRL_MASK));
        fileSaveAs.setText("Save As");
        File.add(fileSaveAs);
        File.add(fileSeperator3);

        filePrint.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_P, java.awt.event.InputEvent.CTRL_MASK));
        filePrint.setText("Print");
        File.add(filePrint);
        File.add(fileSeperator4);

        fileExit.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_F4, java.awt.event.InputEvent.ALT_MASK));
        fileExit.setText("Exit");
        File.add(fileExit);

        mainBar.add(File);

        Edit.setText("Edit");

        editCut.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_X, java.awt.event.InputEvent.CTRL_MASK));
        editCut.setText("Cut");
        Edit.add(editCut);

        editCopy.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_C, java.awt.event.InputEvent.CTRL_MASK));
        editCopy.setText("Copy");
        Edit.add(editCopy);

        editPaste.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_V, java.awt.event.InputEvent.CTRL_MASK));
        editPaste.setText("Paste");
        Edit.add(editPaste);

        mainBar.add(Edit);

        Tools.setText("Tools");

        toolsRun.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_R, java.awt.event.InputEvent.CTRL_MASK));
        toolsRun.setText("Run");
        Tools.add(toolsRun);

        mainBar.add(Tools);

        Window.setText("Window");

        windowMusicalSymbols.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_1, java.awt.event.InputEvent.CTRL_MASK));
        windowMusicalSymbols.setText("Musical Symbols");
        windowMusicalSymbols.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                windowMusicalSymbolsActionPerformed(evt);
            }
        });
        Window.add(windowMusicalSymbols);

        mainBar.add(Window);

        Help.setText("Help");

        helpAbout.setText("About");
        Help.add(helpAbout);

        mainBar.add(Help);

        setJMenuBar(mainBar);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(basePane, javax.swing.GroupLayout.DEFAULT_SIZE, 1017, Short.MAX_VALUE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(basePane, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 635, Short.MAX_VALUE)
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void newFileActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_newFileActionPerformed
        // TODO add your handling code here:
}//GEN-LAST:event_newFileActionPerformed

    private void shortcutScanActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_shortcutScanActionPerformed
      
      NewProcess np = new NewProcess(this);
      np.setLocationRelativeTo(null);
      np.setVisible(true);
}//GEN-LAST:event_shortcutScanActionPerformed

    private void symbolWNActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_symbolWNActionPerformed
        // TODO add your handling code here:
}//GEN-LAST:event_symbolWNActionPerformed

    private void shortcutOpenActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_shortcutOpenActionPerformed
      final JFileChooser fc = new JFileChooser();
        int returnVal = fc.showOpenDialog(null);
        minimizedScore.setVisible(true);
        dummySamplePane.setVisible(true);
        windowSymbols.setVisible(true);
        minimizedLabel.setText("Original Image");
        
}//GEN-LAST:event_shortcutOpenActionPerformed

    private void windowMusicalSymbolsActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_windowMusicalSymbolsActionPerformed


        if(windowSymbols.isVisible())
        {
            windowSymbols.setVisible(false);
        }
        else
        {
             windowSymbols.setVisible(true);
        }
    }//GEN-LAST:event_windowMusicalSymbolsActionPerformed

    private void minimizedSelected(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_minimizedSelected

        if(minDummy)
        {
            minDummy = false;
            ImageIcon icon = new ImageIcon("src/Images/minGeneratedMusicSheet.png");
             minimizedDummyImage.setIcon(icon);
            icon = new ImageIcon("src/Images/SampleMusicSheet.png");
            dummyImage.setIcon(icon);
          minimizedLabel.setText("Generated Image");
            dummySamplePane.setTitle("Moonlight Sonata - Original Score");
        }
        else
        {
            minDummy = true;
            ImageIcon icon = new ImageIcon("src/Images/minSampleMusicSheet.png");
             minimizedDummyImage.setIcon(icon);
            icon = new ImageIcon("src/Images/GeneratedMusicSheet.png");
            dummyImage.setIcon(icon);

              minimizedLabel.setText("Original Image");
         
           
        }
        repaint();
        
       
    }//GEN-LAST:event_minimizedSelected

    private void minimizedEntered(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_minimizedEntered


        toggleImageStatus.setText("Toggle Original/Generated Image");
        validate();
        repaint();
    }//GEN-LAST:event_minimizedEntered

    private void minimizedExited(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_minimizedExited
        toggleImageStatus.setText("");
        validate();
        repaint();
    }//GEN-LAST:event_minimizedExited

    private void playButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_playButtonActionPerformed

     try {
          sequencer = MidiSystem.getSequencer();
          if (sequencer == null)
              throw new MidiUnavailableException();
          //added comment
          sequencer.open();
          FileInputStream is = new FileInputStream("test.mid");
          Sequence mySeq = MidiSystem.getSequence(is);
          sequencer.setSequence(mySeq);
          sequencer.start();
      } catch (Exception e) {
          e.printStackTrace();
      }
    }//GEN-LAST:event_playButtonActionPerformed

    private void stopButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_stopButtonActionPerformed
       try
       {
           sequencer.stop();
       }
       catch(Exception e)
       {
             e.printStackTrace();
       }
    }//GEN-LAST:event_stopButtonActionPerformed

    private void paueButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_paueButtonActionPerformed
       
    }//GEN-LAST:event_paueButtonActionPerformed

    /**
    * @param args the command line arguments
    */
    public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new mainMenu().setVisible(true);
            }
        });
    }

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JMenu Edit;
    private javax.swing.JMenu File;
    private javax.swing.JMenu Help;
    private javax.swing.JMenu Tools;
    private javax.swing.JMenu Window;
    private javax.swing.JLabel background;
    public static javax.swing.JLayeredPane basePane;
    private javax.swing.JLabel dummyImage;
    public static javax.swing.JInternalFrame dummyNewPane;
    private javax.swing.JInternalFrame dummySamplePane;
    private javax.swing.JScrollPane dummyScrollPane;
    private javax.swing.JMenuItem editCopy;
    private javax.swing.JMenuItem editCut;
    private javax.swing.JMenuItem editPaste;
    private javax.swing.JMenuItem fileClose;
    private javax.swing.JMenuItem fileExit;
    private javax.swing.JMenu fileNew;
    private javax.swing.JMenuItem fileOpen;
    private javax.swing.JMenuItem filePrint;
    private javax.swing.JMenuItem fileSave;
    private javax.swing.JMenuItem fileSaveAs;
    private javax.swing.JSeparator fileSeperator1;
    private javax.swing.JSeparator fileSeperator2;
    private javax.swing.JSeparator fileSeperator3;
    private javax.swing.JSeparator fileSeperator4;
    private javax.swing.JMenuItem helpAbout;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JSeparator jSeparator1;
    private javax.swing.JSeparator jSeparator2;
    private javax.swing.JMenuBar mainBar;
    private javax.swing.JPanel mainPanel1;
    public static javax.swing.JLayeredPane mainRightPane;
    private javax.swing.JLabel minimizedDummyImage;
    private javax.swing.JLabel minimizedLabel;
    public static javax.swing.JPanel minimizedScore;
    private javax.swing.JMenuItem newFile;
    private javax.swing.JMenuItem newScan;
    private javax.swing.JButton paueButton;
    public static javax.swing.JLayeredPane phasePane;
    private javax.swing.JToolBar playBackToolbar;
    private javax.swing.JButton playButton;
    private javax.swing.JButton shortcutOpen;
    private javax.swing.JButton shortcutScan;
    private javax.swing.JButton stopButton;
    private javax.swing.JToggleButton symbolEN;
    private javax.swing.JToggleButton symbolER;
    private javax.swing.JToggleButton symbolHN;
    private javax.swing.JToggleButton symbolHR;
    private javax.swing.JToggleButton symbolQN;
    private javax.swing.JToggleButton symbolQR;
    private javax.swing.JToggleButton symbolSN;
    private javax.swing.JToggleButton symbolSR;
    private javax.swing.JToggleButton symbolWN;
    private javax.swing.JToggleButton symbolWR;
    private javax.swing.JLabel toggleImageStatus;
    private javax.swing.JMenuItem toolsRun;
    private javax.swing.JCheckBoxMenuItem windowMusicalSymbols;
    public static javax.swing.JInternalFrame windowSymbols;
    // End of variables declaration//GEN-END:variables

}
